<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>

<script>
spellcheck_test(
    '<div contenteditable>zz zz zz.</div>',
    '',
    '<div contenteditable>zz zz zz.</div>',
    {
      title: 'Misspelled text in editable DIV is not marked before focused.',
      callback: sample => spellcheck_test(
          sample,
          document => document.querySelector('div').focus(),
          '<div contenteditable>#zz# #zz# #zz#.</div>',
          'Spellchecking in editable DIV triggered on focus.')
    });

spellcheck_test(
    '<textarea>zz zz zz.</textarea>',
    '',
    '<textarea>zz zz zz.</textarea>',
    {
      title: 'Misspelled text in TEXTAREA is not marked before focused.',
      callback: sample => spellcheck_test(
          sample,
          document => document.querySelector('textarea').focus(),
          '<textarea>#zz# #zz# #zz#.</textarea>',
          'Spellchecking in TEXTAREA triggered on focus.')
    });

spellcheck_test(
    '<input value="zz zz zz.">',
    '',
    '<input value="zz zz zz.">',
    {
      title: 'Misspelled text in INPUT is not marked before focused.',
      callback: sample => spellcheck_test(
          sample,
          document => document.querySelector('input').focus(),
          '<input value="#zz# #zz# #zz#.">',
          'Spellchecking in INPUT triggered on focus.')
    });
</script>
